package com.hxht.cmp.controller;

import com.hxht.cmp.common.result.ResultResponse;
import com.hxht.cmp.websocket.PlayList;
import org.springframework.stereotype.Controller;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/playInfo")
public class PlayInfoConteroller {


    /**
     * 获取cmp正在点播的信息
     *
     * @return
     */
    @RequestMapping("/getPlayList")
    @ResponseBody
    public ResultResponse getPlayList() {
        List<Map<String, Object>> cmpPlayList = PlayList.getCmpPlayList();
        if (ObjectUtils.isEmpty(cmpPlayList)) {
            return ResultResponse.init(1, "无点播信息", null);
        }
        return ResultResponse.success(cmpPlayList);
    }

}
